#include<bits/stdc++.h>
using namespace std;
const int N = 1000010;
int f[N];
int main()
{
	int n, m; cin >> n >> m;
	int sum = 0, res = 0;
	for(int i = 1; i <= n; i++)
	{
		cin >> f[i];
		f[i] += f[i-1];
	}
	for(int i = m + 1; i <= n; i++)
		res = max(f[i] - f[i - m - 1], res);
	cout << res << endl;
	return 0; 
 } 